package logics

import (
	"context"
	"git.900sui.cn/kc/kcgin/logs"
	"git.900sui.cn/kc/rpcinterface/client/poplar"
	poplar2 "git.900sui.cn/kc/rpcinterface/interface/poplar"
)

type UserLogic struct {
}

func (u *UserLogic) GetStudent(ctx context.Context, args *poplar2.ArgsGetStudentByName) (*poplar2.ReplyStudent, error) {
	rpcStudent := new(poplar.Student).Init()
	// 必须，释放资源
	defer rpcStudent.Close()

	reply := &poplar2.ReplyStudent{}
	if err := rpcStudent.GetStudentByName(ctx, args, reply); err != nil {
		logs.Info("rpcx调用1错误：", err)
		return nil, err
	}
	return reply, nil
}
